#pragma once
#ifndef MODELALGOMANAGER_H
#define MODELALGOMANAGER_H

#include <QObject>

#include "ContoursExtractor.h"
#include "ContoursPostprocessing.h"
#include "ModelAttributesCalculator.h"
#include "ModelSlicesProducer.h"

class ModelAlgoManager : public QObject
{
    Q_OBJECT

public:
    ModelAlgoManager();
    ~ModelAlgoManager();

signals:
    void sendProcessedContours(const QVector<QVector<Vertex>>& processed_contours);

public slots:
    void extractModelContours(bool hasTexture, const QVector<Triangle>& triangles, const QVector<Edge>& edges,
                              const QVector3D& plane_norm, const QVector3D& u_axis, const QVector3D& v_axis,
                              float stride, float dithering_factor = 0.01f, float merge_threshold = 1e-3f);

private:
    void extractContoursWithoutTexture(const QVector<Triangle>& triangles, const QVector<Edge>& edges,
                                                                    const QVector3D& plane_norm, const QVector3D& u_axis, const QVector3D& v_axis,
                                                                    float stride);
    void extractContoursWithTexture(const QVector<Triangle>& triangles, const QVector<Edge>& edges,
                                                                 const QVector3D& plane_norm, const QVector3D& u_axis, const QVector3D& v_axis,
                                                                 float stride, float dithering_factor = 0.01f, float merge_threshold = 1e-3f);

private:
    std::shared_ptr<ModelSlicesProducer> m_sptr_model_slices_producer;
};

#endif // MODELALGOMANAGER_H
